#ifndef __IGLOBALS_H__
#define __IGLOBALS_H__

#include "imanifs.h"

#define MAXFUNCS       105 
#define copy(x,y) x = y
#define MAXWORDS        400
#define MAXSTRINGS      400
#define MAXOPENFILES    20
#define MAXVARS         1000
#define AVGWRDLEN       100
#define MAXFILTERSPACE  400
#define TRACEQUAN       100
#define STPHASHSIZE     1113
#define PHASHSIZE       1113
#define THASHSIZE       1113
#define NHASHSIZE       1113
#define SHASHSIZE       1113
#define VSIZE           500
#define VStop           v_top
#define VSpush          {if(v_top+1>= &v_stack[0]+2*VSIZE){printf("v_stack overflow\n"); exit(1); } v_top++; }
#define VSpop           v_top--
#define VStype          v_top->v_type
#define VSvalue         v_top->v_value
#define STPSIZE         6000
#define DSIZE           2000
#define STPStop         stp_top
#define STPSpush        { if(stp_top+1>&stp_stack[0]+2*STPSIZE) { printf("stp_stack overflow\n");  my_exit(1); } stp_top++; }
#define STPSpop         stp_top--
#define STPSt           stp_top->stp_t
#define STPSp           stp_top->stp_p
#define STPSs           stp_top->stp_s
#define STPSpushval(s,t,p) {STPSpush; STPSs = (s); STPSt = (t); STPSp = (p);}

extern int false, true;
extern char *infilename;
extern int s_count,b_count,filterlevel,active_filters;
extern int dc1,dc2,dc3,c1,c2,c3;
extern int brecycle,srecycle,varcount,stpcount,memcount;
extern int eodch,current_var;
extern char evalerr,newout;
extern char fnl,sflag,cflag,iflag,fflag,nflag,dflag,pflag, tflags[TRACEQUAN];
extern char filterp[30];
extern int errcount,notfoundcount;
extern int open_file,file_var,current_strg,u_countvec[MAXVARS],retvec[MAXVARS];
extern int b_recquan,s_recquan,ddepth,current_inx,current_outx;
extern int curr_in_mode,curr_out_mode,curr_point,curr_ign,conc;
extern int memargc;
extern char **memargv;
extern unsigned filequan,exprquan,wordquan;
extern char *ngc_allocbuf;
extern char *ngc_allocp;
extern int ngc_allocsize;
extern int dynasizes[2];
extern int pid;
extern int ch ;

extern FILE *infile,*current_out,*current_in;
extern STPPAIR stp_stack[STPSIZE], *stp_top;

extern char** nametable;
extern char** wordtable;
extern DISPLAYITEM     d_stack[DSIZE];
extern DISPLAYITEM     *d_top;
extern VALUE           v_stack[VSIZE];
extern VALUE           *v_top;

extern FITEM  ftable[MAXFUNCS];

extern STPSTACK* phashtab[PHASHSIZE];
extern STPSTACK* thashtab[THASHSIZE];
extern STPSTACK* shashtab[SHASHSIZE];
extern STPSTACK* outside;

extern IO* io_info[MAXVARS];
extern IO* current_io;

extern MEMITEM* nhashtab[NHASHSIZE];

extern EXPR *filter_e[100];
extern EXPR **filetable;
extern EXPR **exprtable;

void dumpnhash(int i);
char* alloc(int size);

#endif // !__IGLOBALS_H__